package com.atguigu.spring.beans.factorybean;

import org.springframework.beans.factory.FactoryBean;

//自定义的FacotryBean 需要实现FactoryBean 接口
public class CarFactoryBean implements FactoryBean<Car> {

	private String brand;
	
	public void setBrand(String brand){
		this.brand = brand;
	}
	
	@Override
	public Car getObject() throws Exception {
		return new Car(brand, 500000);
	}

	/**
	 * 返回bean的类型
	 */
	@Override
	public Class<?> getObjectType() {
		return Car.class;
	}

	/**
	 * 是否单实例
	 */
	@Override
	public boolean isSingleton() {
		return true;
	}

}
